import { IFeidaoAiNodejsComponent } from '@dfeidao/atom-nodejs/interfaces';
import nodejs from '@dfeidao/atom-nodejs/msg/nodejs';
import render from '@dfeidao/atom-nodejs/render/render';
import p001 from './p001';
import p002 from './p002';
import p003 from './p003';

export default async function na001(fd: IFeidaoAiNodejsComponent) {
	// 获取初始化数据
	const res = await nodejs<{ dt: Array<{}>; coun: number }>(fd.data.actionid, fd.data.sessionid,
		'project-assets/zj-000002/s001', {
			filter: {
				responsible_no: "YG00000077",
				equip_depart: "",
				project: "",
				assetsname: "",
				asset_classification: "",
				timeout_alert: "",
				customer_assets: "",
				type: "1",
				name: "maintenance_time",
				pn: 1
			}
		});
	sessionStorage.setItem('sss', "YG00000077");
	sessionStorage.setItem('aaa', "梁日星");
	if (res.dt.length > 0) {
		render(fd.data.node, res.dt, p001, 'p001');
		if (res.coun > 20) {
			render(fd.data.node, res.coun, p003, 'p003');
		}
	} else {
		render(fd.data.node, "", p002, 'p002');
	}
}
